function timing(){
    var nowDate=new Date();
    //console.log(nowDate);//获取当前时间
    var endDate=new Date("2022/6/1 14:00:00");
    //  console.log(endDate);//获取结束时间
    var nowTime=nowDate.getTime();
    var endTime=endDate.getTime();
    //  console.log(nowTime,endTime);//返回毫秒
    var intDate=(endTime-nowTime)/1000
    // console.log(intDate);//剩余时间
    var h=parseInt((intDate/60/60) % 24),
        min=parseInt((intDate/60) % 60),
        s=parseInt((intDate % 60));
        //  console.log(h,min,s);
     document.querySelector('.hour').innerHTML=h;
     document.querySelector('.minute').innerHTML=min;
     document.querySelector('.second').innerHTML=s;      
}
setInterval(function(){
    timing()
},1000)


let div=document.querySelector('.content');
let li1=document.querySelector('#navi');
// console.log(div,li1);
li1.onmouseover=function(){//鼠标移入事件
    div.style.display='block';
}
div.onmousemove=function(){//鼠标移动事件
    div.style.display='none';
}


let ulObj=document.querySelectorAll('.grid-col2-t ul li');
let olObj=document.querySelectorAll('.grid-col2-t ol li');
let last=document.querySelector('.arrow-l');
let next=document.querySelector('.arrow-r');
let divObj=document.querySelector('.grid-col2-t');
// console.log(ulObj,divObj);
let index=0;
let imgindex=0;
let times;

olObj.forEach((li,key)=>{
  li.onclick=function(){
    imgindex=index;
    index=key;
    change()
  } 
  li.onmouseover=function(){
      imgindex=index;
      index=key;
      change()
  }
})
last.onclick=function(){
    imgindex=index;
    index--;
    if(index<0){
     index=ulObj.length-1;  
      }
      change()
}
next.onclick=function(){
    imgindex=index;
    index++;
    if(index>ulObj.length-1){
        index=0;
    }
    change()
}

function show(){//给轮播图设置定时器
    times=setInterval(function(){
        next.onclick();
    },2000)
}
divObj.onmouseover=function(){//鼠标移入箭头出现
    last.style.display='block';
    next.style.display='block';
    clearInterval(times)
}
divObj.onmouseout=function(){//鼠标移出箭头隐藏
    last.style.display='none';
    next.style.display='none';
    show()
}

function change(){
    ulObj[imgindex].className='';
    olObj[imgindex].className='';
    ulObj[index].className='ac';
    olObj[index].className='ac';
}
